package com.lee.message.core.converter.rocketmq;

import com.lee.message.core.converter.MessageConverter;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
import org.springframework.util.StringUtils;

/**
 * rocketMq实现
 */
@Slf4j
public class RocketMQMessageConverter implements MessageConverter<MessageExt> {

    @Override
    public String getUniqueKey(MessageExt messageExt) {
       return StringUtils.hasText(messageExt.getKeys()) ? messageExt.getKeys() : messageExt.getMsgId();
    }

}
